package com.zou.exception;

import com.zou.api.enums.BaseEnum;
import com.zou.api.response.BaseResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/*
 * @auth zoujt
 * @date 2021/3/18
 * @Description
 */
@RestControllerAdvice
public class GlobalException {
    Logger logger = LoggerFactory.getLogger(GlobalException.class);

    @ExceptionHandler(Exception.class)
    public BaseResponse  exception(Exception e){
        BaseResponse baseResponse = new BaseResponse(BaseEnum.EXCEPTION);
        logger.error("系统异常",e);
        return baseResponse;
    }
}
